from loguru import logger

logger.add("a.log", filter=lambda record: record["extra"]["name"] == "service_log", rotation="00:00")
logger.add("b.log", filter=lambda record: record["extra"]["name"] == "app_log", rotation="00:00")

# 这个bind()函数就是在extra里额外增加键值
logger_a = logger.bind(name="service_log")
logger_b = logger.bind(name="app_log")

logger_a.info("Message A")
logger_b.info("Message B")